{# SPDX-FileCopyrightText: © 2014-2015, 2021 Siemens AG
   SPDX-FileCopyrightText: © 2020 Robert Bosch GmbH
   SPDX-FileCopyrightText: © Dineshkumar Devarajan <Devarajan.Dineshkumar@in.bosch.com>

   SPDX-License-Identifier: FSFAP
#}
<div class="container">
  {% if protocol != 'HTTPS' %}
    {{ 'This login uses '|trans }}{{ protocol }}{{', so passwords are transmitted in plain text.'|trans }}
    {{ 'This is not a secure connection.'|trans }}<br/><br/>
  {% endif %}
  {{ info }}
  <form method="post" name="loginFormMain" action="{{ authUrl }}">
    <input type="hidden" name="HTTP_REFERER" value="{{ referrer }}"/>
    <input type="hidden" name="timezone" id="timezone" value="" />
    {% if getOauth %}
      <input type="hidden" name="oauth" value="{{ getOauth }}">
      <script type="text/javascript">document.forms.loginFormMain.submit();</script>
    {% endif %}
    {% if loginProvider == 'password' %}
      <div class="form-group">
        <label class="control-label col-sm-2">{{ 'Username'|trans }}:</label>
        <div class="col-sm-10">
          <input id="unamein" type="text" class="form-control" name="username" placeholder="Enter username" autofocus="autofocus" value="{{ userName|e }}">
        </div>
      </div>
      <title>Toggle Password Visibility</title>
      <div class="form-group">
        <label class="control-label col-sm-2" for="pwd">{{ 'Password'|trans }}:</label>
        <div class="col-sm-10">
          <div class="row ml-0 mr-0">
            <input type="password" id="pwd" class="form-control col-sm-10" placeholder="Enter password" name="password"/>
            <span class="container col-sm-2">
              <img src="images/eyes.png" class="bi bi-eye-slash" id="togglePassword" />
            </span>
          </div>
        </div>
      </div>
    {% endif %}
    <div class="form-group">
      <div class="col-sm-offset-2 col-sm-10">
        {% if loginProvider == 'password' %}
          <button type="submit" class="btn btn-default">{{ 'Login'|trans }}</button>
        {% endif %}
        {% if providerExist %}
          <button type="submit" name="providerCheck" value="{{ providerExist }}" class="btn btn-default">{{ 'Login with '|trans }}{{ providerExist }}</button>
        {% endif %}
      </div>
    </div>
    <script type="text/javascript">document.getElementById("unamein").focus();</script>
    <script type="text/javascript">document.getElementById("timezone").value = Intl.DateTimeFormat().resolvedOptions().timeZone ;</script>
  </form>
</div>
